﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<script type="text/javascript" src="../../Scripts/zTree/js/jquery-1.4.4.min.js"></script>

<script type="text/javascript">
    function OnSubmit() {
        var a0 = $("#new_name").val();
        if ("" == a0) {
            alert("请输入名称");
            return false;
        }
        var a1 = $("#new_type").val();
        if ("" == a1) {
            alert("请选择类型");
            return false;
        }
        var a2 = $("#new_form").val();
        if ("" == a2) {
            alert("请选择表单");
            return false;
        }
        var a3 = $("#new_template").val();
        if ("" == a3) {
            alert("请选择模板");
            return false;
        }
        return true;
    }

    function proRes(ajaxContext) {
        var restag = {};
        try {
            restag = ajaxContext.get_response().get_object();
        } catch (e) {
            alert("程序出现错误，请联系管理员");
            return;  // return if result is not json
        }

        if (restag.res != true) {
            alert(restag.msg);
            return;
        }
        else {
            alert("创建成功");
        }
    }
</script>

<div id="wfcreate">
    <%using (Ajax.BeginForm("DoWFCreate", "WorkFlow", new AjaxOptions { UpdateTargetId = "tmp", OnSuccess = "proRes" }))
      {%>
    <p>
        <input type="submit" value="确定" onclick="return OnSubmit()" />
    </p>
    <p style="margin: 20px 0;">
        <span style="padding-left: 25px;">名称：</span>
        <%=Html.TextBox("new_name", "", new { @style = "width:300px; margin-left:1px; border:solid 1px #6C92AD;" })%></p>
    <p style="margin: 10px 0;">
        类型选择:
        <%=Html.DropDownList("new_type", ViewData["list_wftype"] as List<SelectListItem>, "------请选择------", new { @style = "width:302px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%></p>
    <p style="margin: 10px 0;">
        表单选择:
        <%=Html.DropDownList("new_form", ViewData["list_form"] as List<SelectListItem>, "------请选择------", new { @style = "width:302px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%></p>
    <p style="margin: 10px 0;">
        模板选择:
        <%=Html.DropDownList("new_template", ViewData["list_wftemplate"] as List<SelectListItem>, "------请选择------", new { @style = "width:302px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%></p>
    <p style="margin: 10px 0;">
        短信提醒:
        <%=Html.DropDownList("new_wfdxbz", ViewData["list_wfdxbz"] as List<SelectListItem>,new { @style = "width:302px; margin-left:8px; padding:0px;border-radius:0px 0px 0px 0px;border:solid 1px #6C92AD;" })%></p>
    <p style="margin: 10px 0;">
        <span style="padding-left: 25px;">备注：</span>
        <%=Html.TextBox("new_bz", "", new { @style = "width:300px; margin-left:1px; border:solid 1px #6C92AD;" })%></p>
    <%=Html.Hidden("user_id",ViewData["user_id"]) %>
    <%=Html.Hidden("user_name",ViewData["user_name"]) %>
    <%} %>
</div>
